package com.demo.Controller;

import com.sun.tracing.dtrace.Attributes;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class ParmamsController {
        @GetMapping("/getParams/{userId}")
        public Map<String, String> getParams(@PathVariable("userId") String userId) {  // @PathParam 得到路径参数
            System.out.println("userId=" + userId);
            Map<String, String> map = new HashMap<>();
            map.put("userId", userId);
            return map;
        }

    @PostMapping("/postParams")
    public Map postParams(@RequestBody Map<String, Object> par) {  // @PathParam 得到路径参数
      System.out.println("par="+ par);
      Map result = new HashMap<String, String>();
      result.put("cont", par);
//      result.put("name", name);

      return result;
    }

}
